package com.michael.web.controller;


import com.michael.assist.anno.TokenCheck;
import com.michael.common.error.exception.BizException;
import com.michael.common.result.BaseResult;
import com.michael.facade.model.req.home.HomeIndexReq;
import com.michael.facade.model.res.home.HomeIndexRes;
import com.michael.facade.service.HomeFacade;
import com.michael.web.request.HomeIndexRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeFacade homeFacade;


    @GetMapping("/index")
    @TokenCheck
    public BaseResult<HomeIndexRes> index(HomeIndexRequest request) throws BizException {
        HomeIndexReq req = new HomeIndexReq();
        req.setMessage(request.getMessage());
        return BaseResult.successOf(homeFacade.index(req));
    }

}
